module.exports = (app) => {
	const { INTEGER, DATE } = app.Sequelize;

	const UserStudyDay = app.model.define('user_study_day', {
		id: { type: INTEGER, primaryKey: true, autoIncrement: true },
		user_id: { type: INTEGER, allowNull: false },
		study_date: { type: DATE, allowNull: false },
		word_count: { type: INTEGER, allowNull: false },
		created_at: DATE,
		updated_at: DATE,
	});

	// 关联用户
	UserStudyDay.associate = () => {
		UserStudyDay.belongsTo(app.model.User, { foreignKey: 'user_id' });
	};

	return UserStudyDay;
};
